<?php
/**
 * Created by PhpStorm.
 * Author: 黑瞎子
 * Date: 2018/3/17
 * Time: 19:33
 */

namespace app\api\model;


class User extends BaseModel
{
    //关联UserAddress 一对一
    public function address(){
        return $this->hasOne('UserAddress', 'user_id', 'id');
    }

    //通过openid查询用户
    public static function getOpenID($openid){
        return self::where('openid', '=', $openid)
            ->find();
    }
}